Skip to content

feat!: decode policy revision attributes as Attributes - #150

Merged
tas50 merged 1 commit into
mainfrom
feat/policy-attributes
Nov 27, 2026
Merged

tas50 merged 1 commit into
mainfrom
feat/policy-attributes

Conversation

@tas50

@tas50 tas50 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

PolicyRevision.DefaultAttributes and OverrideAttributes were plain map[string]any. Their numbers therefore still decoded as float64 after #142, and GetRevision followed by CreateRevision or PutPolicy rounded integers above 2^53.

They are now Attributes, the same type node, role and environment attributes use. Numbers decode as json.Number, and policy attributes get Dig and GetString.

Breaking: the two fields are Attributes, and their numbers are json.Number. Because Attributes is a map[string]any, code that only indexes these maps compiles unchanged.

Test plan

  • numbers_test.go adds a lossless policy-attribute case; the existing policy test expects json.Number
  • go test ./... -race, cd integration && go test ./..., golangci-lint

PolicyRevision.DefaultAttributes and OverrideAttributes were plain
map[string]any, so their numbers still decoded as float64 after #142 and
GetRevision followed by CreateRevision or PutPolicy rounded integers above
2^53. They are now Attributes, which decode numbers as json.Number and
give policy attributes Dig and GetString like node, role and environment
attributes.

BREAKING CHANGE: PolicyRevision.DefaultAttributes and OverrideAttributes
are Attributes, and their numbers are json.Number.

Signed-off-by: Tim Smith <tsmith84@proton.me>
@tas50
tas50 merged commit 0da7ea7 into main Nov 27, 2026
7 checks passed
@tas50
tas50 deleted the feat/policy-attributes branch November 27, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant